﻿using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace Model
{
    public class Entity
    {
        public string Id { get; set; }

        [ScaffoldColumn(false)]
        public DateTime? CreateTs { get; set; }


        [ScaffoldColumn(false)]
        public DateTime? CreateBy { get; set; }


        [ScaffoldColumn(false)]
        public DateTime? UpdateTs { get; set; }

        [ScaffoldColumn(false)]
        public string UpdateBy { get; set; }

        #region Tracking
        protected List<string> _changes = new List<string>();
        public List<string> GetChanges()
        {
            return _changes;
        }
        public void AddToChanges(string PropertyName)
        {
            if (!_changes.Contains(PropertyName))
                _changes.Add(PropertyName);
        }
        #endregion
    }

    public class ActiveEntity : Entity
    {
        [ScaffoldColumn(false)]
        public bool IsActive { get; set; }
    }

    public class VerifyEntity : Entity
    {
        public bool IsPendingVerify { get; set; }
        public bool Verify { get; set; }
    }
}
